|
sgdk
|
Timer support. More...
Go to the source code of this file.
Defines | |
| #define | SUBTICKPERSECOND 76800 |
| #define | TICKPERSECOND 300 |
| #define | TIMEPERSECOND 256 |
| #define | MAXTIMER 16 |
Functions | |
| u32 | getSubTick () |
| Returns elapsed subticks from console reset. | |
| u32 | getTick () |
| Returns elapsed ticks from console reset. | |
| u32 | getTime (u16 fromTick) |
| Returns elapsed time from console reset. | |
| fix32 | getTimeAsFix32 (u16 fromTick) |
| Returns elapsed time in second from console reset. | |
| void | startTimer (u16 numTimer) |
| Start internal timer. (0 <= numtimer < MAXTIMER) | |
| u32 | getTimer (u16 numTimer, u16 restart) |
| Get elapsed subticks for specified timer. | |
| void | waitSubTick (u32 subtick) |
| Wait for a certain amount of subticks. | |
| void | waitTick (u32 tick) |
| Wait for a certain amount of ticks. | |
| void | waitMs (u32 ms) |
| Wait for a certain amount of millisecond. | |
Variables | |
| u32 | vtimer |
Timer support.
This unit provides basic timer functions (useful for profiling).
This unit uses V-Int to count frame so disabling V-Int will make timer methods to not work anymore.
| #define MAXTIMER 16 |
Maximum number of timer.
| #define SUBTICKPERSECOND 76800 |
Number of subtick per second.
| #define TICKPERSECOND 300 |
Number of tick per second.
| #define TIMEPERSECOND 256 |
Time sub division per second.
| u32 getSubTick | ( | ) |
Returns elapsed subticks from console reset.
Returns elapsed subticks from console reset (1/76800 second based).
WARNING: this function isn't accurate because of the VCounter rollback.
| u32 getTick | ( | ) |
Returns elapsed ticks from console reset.
Returns elapsed ticks from console reset (1/300 second based).
| u32 getTime | ( | u16 | fromTick | ) |
Returns elapsed time from console reset.
| fromTick | Choose tick or sub tick (more accurate) calculation. |
Returns elapsed time from console reset (1/256 second based).
| fix32 getTimeAsFix32 | ( | u16 | fromTick | ) |
Returns elapsed time in second from console reset.
| fromTick | Choose tick or sub tick (more accurate) calculation. |
Returns elapsed time in second from console reset.
Value is returned as fix32.
| u32 getTimer | ( | u16 | numTimer, |
| u16 | restart | ||
| ) |
Get elapsed subticks for specified timer.
| numTimer | Timer number (0-MAXTIMER) |
| restart | Restart timer if TRUE |
Returns elapsed subticks from last call to startTimer(numTimer).
| void startTimer | ( | u16 | numTimer | ) |
Start internal timer. (0 <= numtimer < MAXTIMER)
| numTimer | Timer number (0-MAXTIMER) |
| void waitMs | ( | u32 | ms | ) |
Wait for a certain amount of millisecond.
| ms | Number of millisecond to wait for. |
WARNING: ~3.33 ms based timer so use 4 ms as minimum wait value.
Also you cannot use this method from the V-Int callback (the method will return immediatly).
| void waitSubTick | ( | u32 | subtick | ) |
Wait for a certain amount of subticks.
| subtick | Number of subtick to wait for. |
WARNING: this function isn't accurate because of the VCounter rollback.
Also you cannot use this method from the V-Int callback (the method will return immediatly).
| void waitTick | ( | u32 | tick | ) |
Wait for a certain amount of ticks.
| tick | Number of tick to wait for. |
WARNING: 5/6 (PAL/NTSC) ticks based timer so use 5/6 ticks as minimum wait value.
Also you cannot use this method from the V-Int callback (the method will return immediatly).